﻿'Imports DCM_HttpListen.DCMHL_Service

Imports System.Data

<Serializable>
Public Class DCM_HttpListen_Record
    Implements IDisposable
    Public DCMHttp_Enum_ConnectStyle As DCMHttp_Enum_ConnectStyle
    Public DCMHttp_Enum_DataBaseName As DCMHttp_Enum_DataBaseName
    Public DCMHttp_Enum_RequestType As DCMHttp_Enum_RequestType
    Public Message As String = ""
    Public ErrMessage As String = ""
    Public Success As Boolean = True
    Public Data As Object = Nothing
    Public Data_1 As Object = Nothing
    Public Data_DataTable_Columns() As Data_DataTable_Column
    Public TimeOut As Integer = 30
    Public IDName As String = "ID"
    Public CaoZuoRen As String = ""
    Public CaoZuoRen_ID As Integer = 0
    Public CaoZuoNeiRong As String = ""
    Public ApplicationStartRndID As Long
    Public ConnectApp As Enum_ConnectApp
    Public AppVersionNumber As Stru_Version
    Public CaoZuoRen_Mac As String = ""
    Public UserServerIPStyle As Enum_ServerIPStyle
    Public Sub New()
    End Sub
    Public Sub New(ErrMessage As String)
        Me.ErrMessage = ErrMessage
        Success = False
    End Sub
    Public Sub New(DT_This As DataTable)
        Me.Data = DT_This
        If IsNothing(DT_This) = False Then
            ReDim Data_DataTable_Columns(DT_This.Columns.Count - 1)
            For i As Integer = 0 To DT_This.Columns.Count - 1
                Data_DataTable_Columns(i) = New Data_DataTable_Column
                Data_DataTable_Columns(i).ColumnName = DT_This.Columns(i).ColumnName
                Data_DataTable_Columns(i).ColumnDataType = DT_This.Columns(i).DataType
            Next
        End If
    End Sub
#Region "IDisposable Support"
    Private disposedValue As Boolean ' 检测冗余的调用
    ' IDisposable
    Protected Overridable Sub Dispose(disposing As Boolean)
        If Not Me.disposedValue Then
            If disposing Then
                If IsNothing(Data) = False Then
                    If Data.GetType Is GetType(DataTable) Then
                        Data.Dispose()
                    End If
                    Data = Nothing
                End If
                If IsNothing(Data_DataTable_Columns) = False Then Data_DataTable_Columns = Nothing
                ' TODO:  释放托管状态(托管对象)。
            End If
            ' TODO:  释放非托管资源(非托管对象)并重写下面的 Finalize()。
            ' TODO:  将大型字段设置为 null。
        End If
        Me.disposedValue = True
    End Sub

    ' TODO:  仅当上面的 Dispose(ByVal disposing As Boolean)具有释放非托管资源的代码时重写 Finalize()。
    'Protected Overrides Sub Finalize()
    '    ' 不要更改此代码。    请将清理代码放入上面的 Dispose(ByVal disposing As Boolean)中。
    '    Dispose(False)
    '    MyBase.Finalize()
    'End Sub

    ' Visual Basic 添加此代码是为了正确实现可处置模式。
    Public Sub Dispose() Implements IDisposable.Dispose
        ' 不要更改此代码。    请将清理代码放入上面的 Dispose (disposing As Boolean)中。
        Dispose(True)
        GC.SuppressFinalize(Me)
    End Sub
#End Region
End Class
<Serializable> _
Public Class Data_DataTable_Column
    Public ColumnName As String
    Public ColumnDataType As System.Type
End Class
<Serializable> _
Public Structure Stru_Version
    Dim a1 As Integer
    Dim a2 As Integer
    Dim a3 As Integer
    Dim a4 As Integer

    Public Sub New(str As String)
        Dim q = str.Split(".")
        If q.Count = 4 Then
            Me.a1 = Val(q(0))
            Me.a2 = Val(q(1))
            Me.a3 = Val(q(2))
            Me.a4 = Val(q(3))
        End If
    End Sub
    Public Sub New(a1 As Integer, a2 As Integer, a3 As Integer, a4 As Integer)
        Me.a1 = a1
        Me.a2 = a2
        Me.a3 = a3
        Me.a4 = a4
    End Sub
    Public Overrides Function tostring() As String
        Return String.Format("{0}.{1}.{2}.{3}", a1, a2, a3, a4)
    End Function
End Structure
